/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.intec.matsab.form;

import java.util.HashMap;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

/**
 *
 * @author matilde
 */
public class PrincipalBean {

    private PanelMap panelMap = new PanelMap();
    private Boolean refresh = false;

    public PrincipalBean() {
        initMap();
        panelMap.put("principal", new Boolean(true));
    }
    
    public PanelMap getPanelMap() {
        refresh = true;
        return panelMap;
    }

    public void updateActionPanel(ActionEvent event) {
        String panel = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("panelToRender");

        initMap();

        panelMap.put(panel, new Boolean(true));
    }

    private void initMap() {
        panelMap.put("principal", new Boolean(false));
        panelMap.put("manejoEstudiantes", new Boolean(false));
        panelMap.put("manejoCarreras", new Boolean(false));
        panelMap.put("manejoPensum", new Boolean(false));
        panelMap.put("manejoTrimestres", new Boolean(false));
        panelMap.put("manejoSecciones", new Boolean(false));
        panelMap.put("manejoAsignaturas", new Boolean(false));
        panelMap.put("editarCalificaciones", new Boolean(false));
        panelMap.put("infoAcademica", new Boolean(false));
        panelMap.put("detallePensum", new Boolean(false));
        panelMap.put("verHistorial", new Boolean(false));
        panelMap.put("seleccion", new Boolean(false));
        
    }
    
    class PanelMap extends HashMap {

        public Boolean getKey(String key) {
            return (Boolean) get(key);
        }
    }
}
